[[...path]].page.tsx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. import React, { useEffect } from 'react';
  2. import EventEmitter from 'events';
  3. import {
  4. IDataWithMeta, IPageInfoForEntity, IPagePopulatedToShowRevision, isClient, pagePathUtils, pathUtils,
  5. } from '@growi/core';
  6. import ExtensibleCustomError from 'extensible-custom-error';
  7. import {
  8. NextPage, GetServerSideProps, GetServerSidePropsContext,
  9. } from 'next';
  10. import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
  11. import dynamic from 'next/dynamic';
  12. import Head from 'next/head';
  13. import { useRouter } from 'next/router';
  14. import { PageAlerts } from '~/components/PageAlert/PageAlerts';
  15. // import { PageComments } from '~/components/PageComment/PageComments';
  16. // import { useTranslation } from '~/i18n';
  17. import { CrowiRequest } from '~/interfaces/crowi-request';
  18. // import { renderScriptTagByName, renderHighlightJsStyleTag } from '~/service/cdn-resources-loader';
  19. // import { useIndentSize } from '~/stores/editor';
  20. // import { useRendererSettings } from '~/stores/renderer';
  21. // import { EditorMode, useEditorMode, useIsMobile } from '~/stores/ui';
  22. import { CustomWindow } from '~/interfaces/global';
  23. import { RendererConfig } from '~/interfaces/services/renderer';
  24. import { ISidebarConfig } from '~/interfaces/sidebar-config';
  25. import { PageModel, PageDocument } from '~/server/models/page';
  26. import UserUISettings, { UserUISettingsDocument } from '~/server/models/user-ui-settings';
  27. import Xss from '~/services/xss';
  28. import { useSWRxCurrentPage, useSWRxPageInfo, useSWRxPage } from '~/stores/page';
  29. import {
  30. usePreferDrawerModeByUser, usePreferDrawerModeOnEditByUser, useSidebarCollapsed, useCurrentSidebarContents, useCurrentProductNavWidth,
  31. } from '~/stores/ui';
  32. import loggerFactory from '~/utils/logger';
  33. // import { isUserPage, isTrashPage, isSharedPage } from '~/utils/path-utils';
  34. // import GrowiSubNavigation from '../client/js/components/Navbar/GrowiSubNavigation';
  35. // import GrowiSubNavigationSwitcher from '../client/js/components/Navbar/GrowiSubNavigationSwitcher';
  36. import { BasicLayout } from '../components/Layout/BasicLayout';
  37. import GrowiContextualSubNavigation from '../components/Navbar/GrowiContextualSubNavigation';
  38. import DisplaySwitcher from '../components/Page/DisplaySwitcher';
  39. // import { serializeUserSecurely } from '../server/models/serializers/user-serializer';
  40. // import PageStatusAlert from '../client/js/components/PageStatusAlert';
  41. import {
  42. useCurrentUser, useCurrentPagePath,
  43. useIsLatestRevision,
  44. useIsForbidden, useIsNotFound, useIsTrashPage, useIsSharedUser,
  45. useIsEnabledStaleNotification, useIsIdenticalPath,
  46. useIsSearchServiceConfigured, useIsSearchServiceReachable, useDisableLinkSharing,
  47. useHackmdUri,
  48. useIsAclEnabled, useIsUserPage, useIsNotCreatable,
  49. useCsrfToken, useIsSearchScopeChildrenAsDefault, useCurrentPageId, useCurrentPathname,
  50. useIsSlackConfigured, useIsBlinkedHeaderAtBoot, useRendererConfig, useEditingMarkdown,
  51. } from '../stores/context';
  52. import { useXss } from '../stores/xss';
  53. import {
  54. CommonProps, getNextI18NextConfig, getServerSideCommonProps, useCustomTitle,
  55. } from './commons';
  56. // import { useCurrentPageSWR } from '../stores/page';
  57. const logger = loggerFactory('growi:pages:all');
  58. const {
  59. isPermalink: _isPermalink, isUsersHomePage, isTrashPage: _isTrashPage, isUserPage, isCreatablePage,
  60. } = pagePathUtils;
  61. const { removeHeadingSlash } = pathUtils;
  62. const IdenticalPathPage = (): JSX.Element => {
  63. const IdenticalPathPage = dynamic(() => import('../components/IdenticalPathPage').then(mod => mod.IdenticalPathPage), { ssr: false });
  64. return <IdenticalPathPage />;
  65. };
  66. const PutbackPageModal = (): JSX.Element => {
  67. const PutbackPageModal = dynamic(() => import('../components/PutbackPageModal'), { ssr: false });
  68. return <PutbackPageModal />;
  69. };
  70. type IPageToShowRevisionWithMeta = IDataWithMeta<IPagePopulatedToShowRevision, IPageInfoForEntity>;
  71. type Props = CommonProps & {
  72. currentUser: string,
  73. pageWithMetaStr: string,
  74. // pageUser?: any,
  75. // redirectTo?: string;
  76. // redirectFrom?: string;
  77. // shareLinkId?: string;
  78. isLatestRevision?: boolean
  79. isIdenticalPathPage?: boolean,
  80. isForbidden: boolean,
  81. isNotFound: boolean,
  82. IsNotCreatable: boolean,
  83. // isAbleToDeleteCompletely: boolean,
  84. isSearchServiceConfigured: boolean,
  85. isSearchServiceReachable: boolean,
  86. isSearchScopeChildrenAsDefault: boolean,
  87. isSlackConfigured: boolean,
  88. // isMailerSetup: boolean,
  89. isAclEnabled: boolean,
  90. // hasSlackConfig: boolean,
  91. // drawioUri: string,
  92. hackmdUri: string,
  93. // mathJax: string,
  94. // noCdn: string,
  95. // highlightJsStyle: string,
  96. // isAllReplyShown: boolean,
  97. // isContainerFluid: boolean,
  98. // editorConfig: any,
  99. isEnabledStaleNotification: boolean,
  100. // isEnabledLinebreaks: boolean,
  101. // isEnabledLinebreaksInComments: boolean,
  102. // adminPreferredIndentSize: number,
  103. // isIndentSizeForced: boolean,
  104. disableLinkSharing: boolean,
  105. rendererConfig: RendererConfig,
  106. // UI
  107. userUISettings: UserUISettingsDocument | null
  108. // Sidebar
  109. sidebarConfig: ISidebarConfig,
  110. };
  111. const GrowiPage: NextPage<Props> = (props: Props) => {
  112. // const { t } = useTranslation();
  113. const router = useRouter();
  114. const UnsavedAlertDialog = dynamic(() => import('./UnsavedAlertDialog'), { ssr: false });
  115. const GrowiSubNavigationSwitcher = dynamic(() => import('../components/Navbar/GrowiSubNavigationSwitcher'), { ssr: false });
  116. const { data: currentUser } = useCurrentUser(props.currentUser != null ? JSON.parse(props.currentUser) : null);
  117. // register global EventEmitter
  118. if (isClient()) {
  119. (window as CustomWindow).globalEmitter = new EventEmitter();
  120. }
  121. // commons
  122. useXss(new Xss());
  123. // useEditorConfig(props.editorConfig);
  124. useCsrfToken(props.csrfToken);
  125. // UserUISettings
  126. usePreferDrawerModeByUser(props.userUISettings?.preferDrawerModeByUser ?? props.sidebarConfig.isSidebarDrawerMode);
  127. usePreferDrawerModeOnEditByUser(props.userUISettings?.preferDrawerModeOnEditByUser);
  128. useSidebarCollapsed(props.userUISettings?.isSidebarCollapsed ?? props.sidebarConfig.isSidebarClosedAtDockMode);
  129. useCurrentSidebarContents(props.userUISettings?.currentSidebarContents);
  130. useCurrentProductNavWidth(props.userUISettings?.currentProductNavWidth);
  131. // page
  132. useCurrentPagePath(props.currentPathname);
  133. useIsLatestRevision(props.isLatestRevision);
  134. // useOwnerOfCurrentPage(props.pageUser != null ? JSON.parse(props.pageUser) : null);
  135. useIsForbidden(props.isForbidden);
  136. useIsNotFound(props.isNotFound);
  137. useIsNotCreatable(props.IsNotCreatable);
  138. // useIsTrashPage(_isTrashPage(props.currentPagePath));
  139. // useShared();
  140. // useShareLinkId(props.shareLinkId);
  141. useIsSharedUser(false); // this page cann't be routed for '/share'
  142. useIsIdenticalPath(false); // TODO: need to initialize from props
  143. // useIsAbleToDeleteCompletely(props.isAbleToDeleteCompletely);
  144. useIsEnabledStaleNotification(props.isEnabledStaleNotification);
  145. useIsBlinkedHeaderAtBoot(false);
  146. useIsSearchServiceConfigured(props.isSearchServiceConfigured);
  147. useIsSearchServiceReachable(props.isSearchServiceReachable);
  148. useIsSearchScopeChildrenAsDefault(props.isSearchScopeChildrenAsDefault);
  149. useIsSlackConfigured(props.isSlackConfigured);
  150. // useIsMailerSetup(props.isMailerSetup);
  151. useIsAclEnabled(props.isAclEnabled);
  152. // useHasSlackConfig(props.hasSlackConfig);
  153. // useDrawioUri(props.drawioUri);
  154. useHackmdUri(props.hackmdUri);
  155. // useMathJax(props.mathJax);
  156. // useNoCdn(props.noCdn);
  157. // useIndentSize(props.adminPreferredIndentSize);
  158. useDisableLinkSharing(props.disableLinkSharing);
  159. useRendererConfig(props.rendererConfig);
  160. // useRendererSettings(props.rendererSettingsStr != null ? JSON.parse(props.rendererSettingsStr) : undefined);
  161. // useGrowiRendererConfig(props.growiRendererConfigStr != null ? JSON.parse(props.growiRendererConfigStr) : undefined);
  162. // const { data: editorMode } = useEditorMode();
  163. let pageWithMeta: IPageToShowRevisionWithMeta | undefined;
  164. if (props.pageWithMetaStr != null) {
  165. pageWithMeta = JSON.parse(props.pageWithMetaStr) as IPageToShowRevisionWithMeta;
  166. }
  167. let shouldRenderPutbackPageModal = false;
  168. if (pageWithMeta != null) {
  169. shouldRenderPutbackPageModal = _isTrashPage(pageWithMeta.data.path);
  170. }
  171. useCurrentPageId(pageWithMeta?.data._id);
  172. useSWRxCurrentPage(undefined, pageWithMeta?.data); // store initial data
  173. // useSWRxPage(pageWithMeta?.data._id);
  174. useSWRxPageInfo(pageWithMeta?.data._id, undefined, pageWithMeta?.meta); // store initial data
  175. useIsTrashPage(_isTrashPage(pageWithMeta?.data.path ?? ''));
  176. useIsUserPage(isUserPage(pageWithMeta?.data.path ?? ''));
  177. useIsNotCreatable(props.isForbidden || !isCreatablePage(pageWithMeta?.data.path ?? '')); // TODO: need to include props.isIdentical
  178. useCurrentPagePath(pageWithMeta?.data.path);
  179. useCurrentPathname(props.currentPathname);
  180. useEditingMarkdown(pageWithMeta?.data.revision.body);
  181. // sync pathname by Shallow Routing https://nextjs.org/docs/routing/shallow-routing
  182. useEffect(() => {
  183. if (isClient() && window.location.pathname !== props.currentPathname) {
  184. router.replace(props.currentPathname, undefined, { shallow: true });
  185. }
  186. }, [props.currentPathname, router]);
  187. const classNames: string[] = [];
  188. // switch (editorMode) {
  189. // case EditorMode.Editor:
  190. // classNames.push('on-edit', 'builtin-editor');
  191. // break;
  192. // case EditorMode.HackMD:
  193. // classNames.push('on-edit', 'hackmd');
  194. // break;
  195. // }
  196. // if (props.isContainerFluid) {
  197. // classNames.push('growi-layout-fluid');
  198. // }
  199. // if (page == null) {
  200. // classNames.push('not-found-page');
  201. // }
  202. return (
  203. <>
  204. <Head>
  205. {/*
  206. {renderScriptTagByName('drawio-viewer')}
  207. {renderScriptTagByName('mathjax')}
  208. {renderScriptTagByName('highlight-addons')}
  209. {renderHighlightJsStyleTag(props.highlightJsStyle)}
  210. */}
  211. </Head>
  212. {/* <BasicLayout title={useCustomTitle(props, t('GROWI'))} className={classNames.join(' ')}> */}
  213. <BasicLayout title={useCustomTitle(props, 'GROWI')} className={classNames.join(' ')}>
  214. <header className="py-0">
  215. <GrowiContextualSubNavigation isLinkSharingDisabled={props.disableLinkSharing} />
  216. </header>
  217. <div className="d-edit-none">
  218. <GrowiSubNavigationSwitcher />
  219. </div>
  220. <div id="grw-subnav-sticky-trigger" className="sticky-top"></div>
  221. <div id="grw-fav-sticky-trigger" className="sticky-top"></div>
  222. <div id="main" className={`main ${isUsersHomePage(props.currentPathname) && 'user-page'}`}>
  223. <div id="content-main" className="content-main grw-container-convertible">
  224. <div className="row">
  225. <div className="col">
  226. { props.isIdenticalPathPage && <IdenticalPathPage /> }
  227. { !props.isIdenticalPathPage && (
  228. <>
  229. <PageAlerts />
  230. { props.isForbidden
  231. ? <>ForbiddenPage</>
  232. : <DisplaySwitcher />
  233. }
  234. <div id="page-editor-navbar-bottom-container" className="d-none d-edit-block"></div>
  235. {/* <PageStatusAlert /> */}
  236. PageStatusAlert
  237. </>
  238. ) }
  239. </div>
  240. </div>
  241. {/* <div className="col-xl-2 col-lg-3 d-none d-lg-block revision-toc-container">
  242. <div id="revision-toc" className="revision-toc mt-3 sps sps--abv" data-sps-offset="123">
  243. <div id="revision-toc-content" className="revision-toc-content"></div>
  244. </div>
  245. </div> */}
  246. </div>
  247. </div>
  248. <footer>
  249. {/* <PageComments /> */}
  250. PageComments
  251. </footer>
  252. <UnsavedAlertDialog />
  253. {shouldRenderPutbackPageModal && <PutbackPageModal />}
  254. </BasicLayout>
  255. </>
  256. );
  257. };
  258. function getPageIdFromPathname(currentPathname: string): string | null {
  259. return _isPermalink(currentPathname) ? removeHeadingSlash(currentPathname) : null;
  260. }
  261. class MultiplePagesHitsError extends ExtensibleCustomError {
  262. pagePath: string;
  263. constructor(pagePath: string) {
  264. super(`MultiplePagesHitsError occured by '${pagePath}'`);
  265. this.pagePath = pagePath;
  266. }
  267. }
  268. async function getPageData(context: GetServerSidePropsContext, props: Props): Promise<IPageToShowRevisionWithMeta|null> {
  269. const req: CrowiRequest = context.req as CrowiRequest;
  270. const { crowi } = req;
  271. const { revisionId } = req.query;
  272. const Page = crowi.model('Page') as PageModel;
  273. const { pageService } = crowi;
  274. const { currentPathname } = props;
  275. const pageId = getPageIdFromPathname(currentPathname);
  276. const isPermalink = _isPermalink(currentPathname);
  277. const { user } = req;
  278. // check whether the specified page path hits to multiple pages
  279. if (!isPermalink) {
  280. const count = await Page.countByPathAndViewer(currentPathname, user, null, true);
  281. if (count > 1) {
  282. throw new MultiplePagesHitsError(currentPathname);
  283. }
  284. }
  285. const result: IPageToShowRevisionWithMeta = await pageService.findPageAndMetaDataByViewer(pageId, currentPathname, user, true); // includeEmpty = true, isSharedPage = false
  286. const page = result?.data as unknown as PageDocument;
  287. // populate & check if the revision is latest
  288. if (page != null) {
  289. page.initLatestRevisionField(revisionId);
  290. await page.populateDataToShowRevision();
  291. props.isLatestRevision = page.isLatestRevision();
  292. }
  293. return result;
  294. }
  295. async function injectRoutingInformation(context: GetServerSidePropsContext, props: Props, pageWithMeta: IPageToShowRevisionWithMeta|null): Promise<void> {
  296. const req: CrowiRequest = context.req as CrowiRequest;
  297. const { crowi } = req;
  298. const Page = crowi.model('Page') as PageModel;
  299. const { currentPathname } = props;
  300. const pageId = getPageIdFromPathname(currentPathname);
  301. const isPermalink = _isPermalink(currentPathname);
  302. const page = pageWithMeta?.data;
  303. if (props.isIdenticalPathPage) {
  304. // TBD
  305. }
  306. else if (page == null) {
  307. props.isNotFound = true;
  308. props.IsNotCreatable = !isCreatablePage(currentPathname);
  309. // check the page is forbidden or just does not exist.
  310. const count = isPermalink ? await Page.count({ _id: pageId }) : await Page.count({ path: currentPathname });
  311. props.isForbidden = count > 0;
  312. }
  313. else {
  314. // /62a88db47fed8b2d94f30000 ==> /path/to/page
  315. if (isPermalink && page.isEmpty) {
  316. props.currentPathname = page.path;
  317. }
  318. // /path/to/page ==> /62a88db47fed8b2d94f30000
  319. if (!isPermalink && !page.isEmpty) {
  320. const isToppage = pagePathUtils.isTopPage(props.currentPathname);
  321. if (!isToppage) {
  322. props.currentPathname = `/${page._id}`;
  323. }
  324. }
  325. }
  326. }
  327. // async function injectPageUserInformation(context: GetServerSidePropsContext, props: Props): Promise<void> {
  328. // const req: CrowiRequest = context.req as CrowiRequest;
  329. // const { crowi } = req;
  330. // const UserModel = crowi.model('User');
  331. // if (isUserPage(props.currentPagePath)) {
  332. // const user = await UserModel.findUserByUsername(UserModel.getUsernameByPath(props.currentPagePath));
  333. // if (user != null) {
  334. // props.pageUser = JSON.stringify(user.toObject());
  335. // }
  336. // }
  337. // }
  338. async function injectServerConfigurations(context: GetServerSidePropsContext, props: Props): Promise<void> {
  339. const req: CrowiRequest = context.req as CrowiRequest;
  340. const { crowi } = req;
  341. const {
  342. appService, searchService, configManager, aclService, slackNotificationService, mailService,
  343. } = crowi;
  344. props.isSearchServiceConfigured = searchService.isConfigured;
  345. props.isSearchServiceReachable = searchService.isReachable;
  346. props.isSearchScopeChildrenAsDefault = configManager.getConfig('crowi', 'customize:isSearchScopeChildrenAsDefault');
  347. props.isSlackConfigured = crowi.slackIntegrationService.isSlackConfigured;
  348. // props.isMailerSetup = mailService.isMailerSetup;
  349. props.isAclEnabled = aclService.isAclEnabled();
  350. // props.hasSlackConfig = slackNotificationService.hasSlackConfig();
  351. // props.drawioUri = configManager.getConfig('crowi', 'app:drawioUri');
  352. props.hackmdUri = configManager.getConfig('crowi', 'app:hackmdUri');
  353. // props.mathJax = configManager.getConfig('crowi', 'app:mathJax');
  354. // props.noCdn = configManager.getConfig('crowi', 'app:noCdn');
  355. // props.highlightJsStyle = configManager.getConfig('crowi', 'customize:highlightJsStyle');
  356. // props.isAllReplyShown = configManager.getConfig('crowi', 'customize:isAllReplyShown');
  357. // props.isContainerFluid = configManager.getConfig('crowi', 'customize:isContainerFluid');
  358. props.isEnabledStaleNotification = configManager.getConfig('crowi', 'customize:isEnabledStaleNotification');
  359. // props.isEnabledLinebreaks = configManager.getConfig('markdown', 'markdown:isEnabledLinebreaks');
  360. // props.isEnabledLinebreaksInComments = configManager.getConfig('markdown', 'markdown:isEnabledLinebreaksInComments');
  361. props.disableLinkSharing = configManager.getConfig('crowi', 'security:disableLinkSharing');
  362. // props.editorConfig = {
  363. // upload: {
  364. // image: crowi.fileUploadService.getIsUploadable(),
  365. // file: crowi.fileUploadService.getFileUploadEnabled(),
  366. // },
  367. // };
  368. // props.adminPreferredIndentSize = configManager.getConfig('markdown', 'markdown:adminPreferredIndentSize');
  369. // props.isIndentSizeForced = configManager.getConfig('markdown', 'markdown:isIndentSizeForced');
  370. props.rendererConfig = {
  371. isEnabledLinebreaks: configManager.getConfig('markdown', 'markdown:isEnabledLinebreaks'),
  372. isEnabledLinebreaksInComments: configManager.getConfig('markdown', 'markdown:isEnabledLinebreaksInComments'),
  373. adminPreferredIndentSize: configManager.getConfig('markdown', 'markdown:adminPreferredIndentSize'),
  374. isIndentSizeForced: configManager.getConfig('markdown', 'markdown:isIndentSizeForced'),
  375. plantumlUri: process.env.PLANTUML_URI ?? null,
  376. blockdiagUri: process.env.BLOCKDIAG_URI ?? null,
  377. // XSS Options
  378. isEnabledXssPrevention: configManager.getConfig('markdown', 'markdown:xss:isEnabledPrevention'),
  379. attrWhiteList: crowi.xssService.getAttrWhiteList(),
  380. tagWhiteList: crowi.xssService.getTagWhiteList(),
  381. highlightJsStyleBorder: crowi.configManager.getConfig('crowi', 'customize:highlightJsStyleBorder'),
  382. };
  383. props.sidebarConfig = {
  384. isSidebarDrawerMode: configManager.getConfig('crowi', 'customize:isSidebarDrawerMode'),
  385. isSidebarClosedAtDockMode: configManager.getConfig('crowi', 'customize:isSidebarClosedAtDockMode'),
  386. };
  387. }
  388. /**
  389. * for Server Side Translations
  390. * @param context
  391. * @param props
  392. * @param namespacesRequired
  393. */
  394. async function injectNextI18NextConfigurations(context: GetServerSidePropsContext, props: Props, namespacesRequired?: string[] | undefined): Promise<void> {
  395. const nextI18NextConfig = await getNextI18NextConfig(serverSideTranslations, context, namespacesRequired);
  396. props._nextI18Next = nextI18NextConfig._nextI18Next;
  397. }
  398. export const getServerSideProps: GetServerSideProps = async(context: GetServerSidePropsContext) => {
  399. const req: CrowiRequest = context.req as CrowiRequest;
  400. const { user } = req;
  401. const result = await getServerSideCommonProps(context);
  402. // check for presence
  403. // see: https://github.com/vercel/next.js/issues/19271#issuecomment-730006862
  404. if (!('props' in result)) {
  405. throw new Error('invalid getSSP result');
  406. }
  407. const props: Props = result.props as Props;
  408. let pageWithMeta;
  409. try {
  410. pageWithMeta = await getPageData(context, props);
  411. props.pageWithMetaStr = JSON.stringify(pageWithMeta);
  412. }
  413. catch (err) {
  414. if (err instanceof MultiplePagesHitsError) {
  415. props.isIdenticalPathPage = true;
  416. }
  417. else {
  418. throw err;
  419. }
  420. }
  421. injectRoutingInformation(context, props, pageWithMeta);
  422. injectServerConfigurations(context, props);
  423. injectNextI18NextConfigurations(context, props, ['translation']);
  424. if (user != null) {
  425. props.currentUser = JSON.stringify(user);
  426. }
  427. // UI
  428. const userUISettings = user == null ? null : await UserUISettings.findOne({ user: user._id }).exec();
  429. props.userUISettings = JSON.parse(JSON.stringify(userUISettings));
  430. return {
  431. props,
  432. };
  433. };
  434. export default GrowiPage;